package com.wmzdq.aiservice.service;

import com.wmzdq.aiservice.feign.BabyService;
import com.wmzdq.vo.BaseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RecordTools {

    @Autowired
    BabyService babyService;

    @Tool(description = "记录婴儿的日常活动时间，比如几点喝了奶粉多少毫升，几点喝了母乳，几点换尿片等")
    public String record(@ToolParam(description = "记录时间，格式是yyyyMMdd HH:mm:ss，",required = false) String datetime,
                         @ToolParam(description = "记录活动类型，0-喂奶，1-亲喂，2-大便，3-换尿包") String type,
                         @ToolParam(description = "记录数量，比如奶粉100ml,就传100，尿包默认是1") int capacity){
        log.info("datetime:"+datetime+"type:"+type+"capacity:"+capacity);
        BaseVo vo=babyService.handle(type,capacity,datetime);
        if(vo.getCode()==0){
            return "记录成功";
        }
        return "记录失败";
    }
}
